﻿/**
* jQuery twiLoadingMask plugin
* @author: feitianxinhong  http://xuzhihong1987.blog.163.com/
* @version 2.0.0
* @create date:2013-08-20
* @copyright (c) 2013 feitianxinhong/tyingsoft/twilight  http://www.tyingsoft.com
* @example Visit http://blog.163.com/twi_fly
*/
(function ($) {
	var global = this;
	if (typeof Twi === 'undefined') {
		global.Twi = {};
	}
	Twi.global = global;
	Twi.LoadingMask = function (config) {
		config = config || {};
		this.msg = config.msg || "正在加载数据......";
		this.renderTo = config.renderTo || "body";
		this.id = "TwiLoadingMask" + Math.floor(100000 * Math.random()); //随机ID     
	}
	Twi.LoadingMask.prototype.show = function () {
		var html = '<div id="' + this.id + '">';
		html += '<div class="twiLoadingMaskBg"></div>';
		html += '<div class="twiLoadingMaskCnt"><span type="twiLoadingMaskMsg">' + this.msg + '</span></div>';
		html += '</div>';
		$(this.renderTo).append(html);
	}
	Twi.LoadingMask.prototype.hide = function () {
		$('#' + this.id).remove();
	}
})(jQuery);

